package com.zlp.mall.portal.modules.sms.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.zlp.mall.common.util.BeanToUtils;
import com.zlp.mall.portal.modules.pms.dto.resp.HomeAdvertiseResp;
import com.zlp.mall.portal.modules.sms.model.HomeAdvertise;
import com.zlp.mall.portal.modules.sms.mapper.HomeAdvertiseMapper;
import com.zlp.mall.portal.modules.sms.service.HomeAdvertiseService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 首页轮播广告表 服务实现类
 * </p>
 *
 * @author ZouLiPing
 * @since 2021-10-14
 */
@Service
public class HomeAdvertiseServiceImpl extends ServiceImpl<HomeAdvertiseMapper, HomeAdvertise> implements HomeAdvertiseService {

    @Override
    public List<HomeAdvertiseResp> getBannerList() {
        LambdaQueryWrapper<HomeAdvertise> queryWrapper = new LambdaQueryWrapper();
        queryWrapper.eq(HomeAdvertise::getType,1);
        queryWrapper.eq(HomeAdvertise::getStatus,1);
        List<HomeAdvertise> advertiseList = this.list(queryWrapper);
        List<HomeAdvertiseResp> homeAdvertiseResps = BeanToUtils.entityToList(advertiseList, HomeAdvertiseResp.class);
        return homeAdvertiseResps;
    }
}
